package com.songyang.Restaurant.Controller;


import com.songyang.Restaurant.Model.Restaurant;
import com.songyang.Restaurant.Service.RestaurantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;

@RestController
public class RestaurantController {
    @Autowired
    private RestaurantService restaurantService;
    BigDecimal bigDecimalFromDouble = new BigDecimal(1.4);
    @GetMapping("/restaurants")
    public List<Restaurant> getRestaurants() {
        Restaurant restaurant = new Restaurant("惊喜餐厅", "市中心", bigDecimalFromDouble, LocalDate.now(), LocalDate.now());

        restaurantService.addRestaurant(restaurant);

        return List.of(
               restaurant
        );
    }
}
